import domain.Car;
import view.Windows;

import java.util.List;

public class Application {
    public static void main(String[] args) {
        Windows windows = new Windows();

        windows.windowsView_user();

        while (true) {

            switch (windows.windowsView_car()) {
                case 1:
                    System.out.println("执行查询车辆信息！");
                    List<Car> carList = windows.car_list();
                    for (Car car : carList) {
                        System.out.println(car);
                    }
                    break;
                case 2:
                    System.out.println("执行新增车辆信息！");
                    if (windows.car_add() > 0) {
                        System.out.println("执行成功！");
                    } else {
                        System.out.println("执行失败！检查你所输入的值!");
                    }
                    break;
                case 3:
                    System.out.println("执行修改车辆信息！");
                    if (windows.car_update() > 0) {
                        System.out.println("执行成功！");
                    } else {
                        System.out.println("执行失败！请检查你所输入的值！");
                    }
                    break;
                case 4:
                    System.out.println("执行删除车辆信息！");
                    if (windows.car_delete() > 0) {
                        System.out.println("执行成功！");
                    } else {
                        System.out.println("执行失败！请检查你所输入的值！");
                    }
                    break;
                case 5:
                    System.out.println("再见！");
                    return;
                default:
                    System.out.println("输入错误的序号！请重新输入！");
                    break;
            }
        }
    }
}

